import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// *********************************** 路径配置新增 start
import { resolve } from 'path'
const srcPath = resolve(__dirname, 'src');

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: [
      { find: '@', replacement: srcPath },
    ],
  },
  //配置跨域
  server: {
    open: false,  //启动项目后打开浏览器
    proxy: {
      '/test': {
        target: 'http://localhost:80',  //API服务地址
        changeOrigin: true,             //开启跨域
        rewrite: (path) => path.replace(/^\/test/, '')
      }
    }
  }
})
